import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import Layout from '@/layout/index.vue'

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        redirect: '/dashboard',
        component: Layout,
        children: [
            {
                path: '/dashboard',
                name: 'dashboard',
                component: () => import('@/views/dashboard/Index.vue'),
                meta:{
                    title:'首页',
                    icon:'House',
                    roles:["sys:dashboard"],
                }
            },
        ]
    },
    {
        path: "/system",
        component: Layout,
        name: "system",
        meta: {
            title: "系统管理",
            icon: "Setting",
            roles: ["sys:manage"],
        },
        children: [
            {
                path: "/userList",
                component: () => import('@/views/system/User/UserList.vue'),
                name: "userList",
                meta: {
                    title: "用户管理",
                    icon: "UserFilled",
                    roles: ["sys:user"],
                }
            },
            {
                path: "/roleList",
                component: () => import('@/views/system/Role/RoleList.vue'),
                name: "roleList",
                meta: {
                    title: "角色管理",
                    icon: "Wallet",
                    roles: ["sys:role"],
                }
            },
            {
                path: "/menuList",
                component: () => import('@/views/system/Menu/MenuList.vue'),
                name: "menuList",
                meta: {
                    title: "菜单管理",
                    icon: "Menu",
                    roles: ["sys:menu"],
                }
            },
            {
                path: "/departmentList",
                component: () => import('@/views/system/Department/DepartmentList.vue'),
                name: "departmentList",
                meta: {
                    title: "部门管理",
                    icon: "OfficeBuilding",
                    roles: ["sys:department"],
                }
            },
            {
                path: "/workflowList",
                component: () => import('@/views/system/Workflow/WorkflowList.vue'),
                name: "workflowList",
                meta: {
                    title: "工作流管理",
                    icon: "Connection",
                    roles: ["sys:workflow"],
                }
            },

        ]
    },
    {
        path: "/goodsRoot",
        component: Layout,
        name: "goodsRoot",
        meta: {
            title: "商品管理",
            icon: "Setting",
            roles: ["sys:goodsRoot"],
        },
        children: [
            {
                path: "/category",
                component: () => import('@/views/goods/Category/List.vue'),
                name: "category",
                meta: {
                    title: "物料类型",
                    icon: "UserFilled",
                    roles: ["sys:category"],
                }
            },
            {
                path: "/goodsList",
                component: () => import('@/views/goods/GoodsList.vue'),
                name: "goodsList",
                meta: {
                    title: "商品信息",
                    icon: "Wallet",
                    roles: ["sys:goodsList"],
                }
            },

        ]
    },
]



const router = createRouter({
    history: createWebHistory(),
    routes
})


export default router




